<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function(){
	var MySuccess = function(result){
		//alert(result);

	    alert(result.hero);
	};
	
	var MyError = function(){
		alert('错误');
	};
	
	var myClick = function(){
		$.ajax({
			url:"testAction",
			type:'POST',
			//data:
			dataType:'json',
			success:MySuccess,
			timeout:3000,
			error:MyError
		});
	};
	
	$("#test01").click(myClick);
	
	
});
</script>
</head>
<body>
<div id="test01">获取服务器数据</div>
</body>
</html>